//package com.bwie.rabbit;
//
//
//import com.bwie.config.DelayedQueueConfig;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//
//import java.util.Date;
//
//@Controller
//public class Production {
//    @Autowired
//    private RabbitTemplate rabbitTemplate;
//
//    private final Logger log = LoggerFactory.getLogger(Production.class);
//
//    private static final String QUEUE_NAME_JIAN =MyQueue.QUEUE_NUM_SUBTRACT;
//    private static final String QUEUE_NAME_JIA =MyQueue.QUEUE_NUM_PLUS;
//
//    public void sendSubtract(Integer msg){
//        System.out.println("接收到的参数是"+msg);
//        rabbitTemplate.convertAndSend(QUEUE_NAME_JIAN,msg);
//    }
//    public void sendPlus(Integer msg){
//        System.out.println("接收到的参数是:"+msg);
//        rabbitTemplate.convertAndSend(QUEUE_NAME_JIA,msg);
//    }
//
//    //发消息 基于插件的   消息及 延迟的时间
//    @GetMapping("sendDelayMsg/{message}/{delayTime}")
//    public void sendMsg(@PathVariable String message, @PathVariable Integer delayTime){
//        log.info("当前时间：{}，发送一条时长{}毫秒消息给延迟队列delayed.queue：{}",new Date().toString(),delayTime,message);
//        rabbitTemplate.convertAndSend(DelayedQueueConfig.DELAYED_EXCHANGE_NAME,DelayedQueueConfig.DELAYED_routing_KEY,message, msg->{
//            //发送消息的时候  延迟时长
//            msg.getMessageProperties().setDelay(delayTime);
//            return msg;
//        });
//    }
//
//
//}
